package competition;

import java.util.Scanner;

/**
 * Author: 笨蛋超人不会飞
 * Date:  14:53
 */
public class c_05 {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int n=scanner.nextInt();
        int arr[]=new int[n];
        for (int i = 0; i < n; i++) {
            arr[i]=scanner.nextInt();
        }
        int err[]=new int[n];
        int sum=1;
        err[0]=arr[0];
        for (int i = 1; i <arr.length; i++) {
            boolean tf=false;
            for (int j = 0; j <sum ; j++) {
//                用贪心算法
               if((arr[i]>err[j])&&(err[j+1]==0||arr[i]<=err[j+1])){
                   err[j]=arr[i];
                   tf=true;
                   break;
               }
            }
            if(!tf){
//                将arr[i]插入到err数组下标为0的位置，其余位置往后移
                for (int j = sum-1; j >=0 ; j--) {
                    err[j+1]=err[j];

                }
                err[0]=arr[i];
                sum++;

            }
        }
        System.out.println(sum);
    }

}
